<template>
    <div>
<h1>门店信息添加</h1>
<table class="table table-bordered" border="1">
    <tr>
        <td>订单数量</td>
        <td><input type="text" v-model="ad.shop_shul"></td>
    </tr>

    <tr>
        <td>实际收款</td>
        <td><input type="text" v-model="ad.shop_actual"></td>
    </tr>

    <tr>
        <td>平均售价</td>
        <td><input type="text"  v-model="ad.shop_Price"></td>
    </tr>

    <tr>
        <td>退款金额</td>
        <td><input type="text" v-model="ad.shop_Amoutn"></td>
    </tr>

    <tr>
        <td>门店趋势</td>
        <td><input type="text" v-model="ad.shop_Trends"></td>
    </tr>


    <tr>
        <td>门店编号</td>
        <td><select v-model="ad.shop_wjid">
            <option :value="0">请选择</option>
            <option v-for="item in xs" :value="item.shop_id">{{item.shop_name}}</option>
        </select></td>
    </tr>

    <tr>
        <td></td>
        <td><input type="button" value="修改" @click="pdadd"></td>
    </tr>
</table>
    </div>
</template>

<script setup lang="ts">
import { ref,onMounted, pushScopeId} from "vue";
import axios from "axios";
import { useRoute } from "vue-router";


const Route=useRoute();
const ad=ref({

    shop_id: 0,
  shop_shul: 0,
  shop_actual: 0,
  shop_Price: 0,
  shop_Amoutn: 0,
  shop_Trends: "",
  shop_wjid: 0

})



onMounted(()=>{

    dbxs();
    fant();
})



const xs=ref([{


shop_id: 0,
shop_name: "",
shop_Branchname: "",
shop_Address: "",
shop_pone: "",
shop_zt: true,
shop_js: "",
shop_Nptic: "",
jtxx: "",
shop_Img: ""


}])

const dbxs=()=>{
axios.get('https://localhost:7268/api/md/mendianshow')

.then(res=>{

    xs.value=res.data;
    
})
.then(error=>{


   console.log(error) 
})




}





const pdadd=()=>{
axios.put('https://localhost:7268/api/md/mdxxxg',ad.value)
.then(res=>{

if(res.data>0)
{
alert('修改成功');

}
else{

    alert('修改失败');
}

})
.catch(error=>{

console.log(error)


})





}




const fant=()=>{
axios.get('https://localhost:7268/api/md/mdxxesxg',{

    params:{

        id:Route.params.id

    }


})
.then(res=>{

    ad.value=res.data

})


}



</script>

<style scoped>

</style>